/*
 * Machine.java
 *
 * Created on 5 de junio de 2007, 08:50
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package wsserver;

import java.net.InetAddress;
import java.net.UnknownHostException;
import javax.jws.WebService;

/**
 *
 * @author mariano
 */
@WebService()
public class Computer {
    
    public static final int STATUS_OFFLINE = 0;
    public static final int STATUS_ONLINE = 1;
    
    private String name;
    private String ip;
    private int status;
    
    /** Creates a new instance of Machine */
    public Computer() {
    }
    
    public Computer( String name, String ip, int status ) {
        this.setName(name);
        //try{
        this.setIp(ip);
        //}catch(UnknownHostException e){e.printStackTrace();}
        this.setStatus(status);
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

  

  

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }
    
    public boolean equals( Object obj )
    {
        Computer c = (Computer) obj;
        
        if( this.getIp().equals( c.getIp() ) && this.getName().equalsIgnoreCase( c.getName() ) )
        {
            return true;
        }
        
        return false;
    }
    
    public String toString()
    {
        return "Computer " + this.getName() + " (" + this.getIp().toString() + ") status: " + this.getStatus();
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }
}
